package com.zpself.module.算法练习.String;

/**
 * @author By ZengPeng
 * @Description
 * @date in  2021/1/20 19:13
 * @Modified By
 */
public class 力扣_434_字符串中的单词数 {
    public static void main(String[] args) {

        System.out.println(myAnswer("Hello, my name is John"));
        System.out.println(myAnswer(", , , ,        a, eaefa"));
    }

    public  static  int myAnswer(String s){
        s = s.trim();
        if( s.equals(""))
            return 0;
        return s.split("\\s+").length;
    }
}
